﻿/*
 * 由SharpDevelop创建。
 * 用户： newmin
 * 日期: 2013/11/3
 * 时间: 15:50
 * 
 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
 */
using System;
using Ops.Xml;
using Spc;
using Ops.Template;

namespace OnlinePluginDepository
{
	/// <summary>
	/// Description of Demo.
	/// </summary>
	public class Demo
	{
		public Demo()
		{
			
			#region xmlobject的插入使用
			
			//将插件添加到list.xml中
			SettingFile setting=new SettingFile(String.Concat(Cms.PyhicPath,"plugins/spc.spdepository/list.xml"));
			setting.Append("com.demo","测试插件");
			
			setting.Flush();
		  //
		  //
		  //
			
			
			//插件存放在packs下存为各自的xml文件
			AutoObjectXml x=new AutoObjectXml(String.Concat(Cms.PyhicPath,"plugins/spc.spdepository/packs/","com.demo.xml"));
			x.InsertObjectNode("com.demo","测试插件","插件的描述",
			                   new XmlObjectProperty("sourceUrl","插件源码地址","http://"),
			                   new XmlObjectProperty("releaseUrl","发布包地址","releases/com.demo.zip"),
			                   new XmlObjectProperty("version","插件版本","1.0.0"),
			                   new XmlObjectProperty("icon","插件图标","icons/com.demo.zip")
			                  );
			
			x.Flush();
			
			#endregion
			
			#region 模板显示页面
			
			TemplatePage tpl=new TemplatePage();
			tpl.TemplateContent="${对象.属性}<!--实际应用中应当读取文件-->";
			tpl.AddVariable("对象",new{属性="it's property"});
			
			//显示出来
			tpl.Render();
			
			//
			//页面输出：
			// it's property<!--实际应用中应当读取文件-->
			//
			
			#endregion
		}
	}
}
